const { exec, escape } = require('../db/mysql')

const login = (username, password) => {
    const sql = `select username, realname from users where username='${username}' and password='${password}'`

    console.log('sql', sql);
    return exec(sql).then(rows => {
        console.log('rows', rows);
        return rows[0] || {}
    })


    // if (username === 'zhangsan' && password === '123') {
    //     return true
    // }

    // return false
}

module.exports = { login };